const router = require('koa-router')()
router.prefix('/answers/:questionId')
const {
    find,
    findById,
    create,
    update,
    deleteAnswers,
    checkAnswerser,
    checkAnswersExist
} = require("../controller/answers")
const auth = require("../utils/auth")

// 查询回答列表
router.get("/", find)
// 创建一个回答
router.post("/", auth, create)
// 根据ID查询特定回答
router.get("/:id", checkAnswersExist, findById)
// 更新一个回答
router.patch("/:id", auth, checkAnswersExist, checkAnswerser, update)
// 删除一个问题
router.delete("/:id", auth, checkAnswersExist, checkAnswerser, deleteAnswers)


module.exports = router
